<!--
 * @Description: 
 * @Author: lz
 * @Date: 2022-12-29 21:34:44
 * @LastEditTime: 2022-12-29 22:10:12
 * @LastEditors: lz
-->
<template>
  <div class="box">
    <img src="../../assets/images/bg.png"/>
    <div class="box2">

    <div style="width: 50%;"><div class="span1">镇海区"项目码上智办"全链条服务应用管理系统</div></div>
    <form class="form-signin">
      <h2 class="form-signin-heading">欢迎登录</h2>
          <input
            v-model="username"
            type="text"
            class="form-control hidden"
            name="nickname"
            placeholder="账号"
            required=""
            autofocus=""
          />
          <input
            v-model="password"
            type="password"
            class="form-control"
            name="password"
            placeholder="密码"
            required=""
          />

          <button
            class="btn btn-lg btn-primary btn-block"
            @click.prevent="login()"
          >
            登录
          </button>
        </form>
      </div>
  </div>
  <!-- <div class="modal fade" id="login">
    <div class="modal-dialog">
      <div class="modal-content">
        <form class="form-signin">
          <h2 class="form-signin-heading">请登录</h2>
          <input
            v-model="username"
            type="text"
            class="form-control hidden"
            name="nickname"
            placeholder="账号"
            required=""
            autofocus=""
          />
          <input
            v-model="password"
            type="password"
            class="form-control"
            name="password"
            placeholder="密码"
            required=""
          />

          <button
            class="btn btn-lg btn-primary btn-block"
            @click.prevent="login()"
          >
            登录
          </button>
        </form>
      </div>
    </div>
  </div> -->
</template>

<script>
import { Login } from "@/api/commonApi";
export default {
  data() {
    return {
      username: "adminzzd", // admincq
      password: "123456"
    };
  },
  methods: {
    login() {
      const { username, password } = this;
      Login({
        username,
        password
      }).then(res => {
        // roleType 默认0代办人员 1窗口人员
        // 角色有两类1：窗口人员 （菜单：问题协办，流程协助）  2：代办人员 （菜单：项目中心，我管理的项目。问题协办，工作日志）
        this.$store.commit("app/M_SET_ROLE_TYPE", res.data.roleType);
        localStorage.setItem("P-User-Info", JSON.stringify(res.data));
        localStorage.setItem("X-Role-Type", res.data.roleType);
        localStorage.setItem("X-Access-Token", res.data.token || "");
        this.$message({
          message: res.msg,
          type: "success"
        });
        if (res.data.roleType) {
          this.$router.push("/organizing/problem");
        } else {
          this.$router.push("/");
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.box{
  height: calc(100% - 0px);
  margin: auto;
  display: flex;
  img{
    height: calc(100% - 40px);
    margin: auto;
  }
  // background-image: url("../../assets/images/bg.png");
}
/*模态框*/
.box2{
  position: absolute;
  display: flex;
  width: 100%;
}
.modal-header .close {
  margin-top: -2px;
}
button.close {
  -webkit-appearance: none;
  padding: 0;
  cursor: pointer;
  background: 0 0;
  border: 0;
}
.close {
  float: right;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  color: #000;
  text-shadow: 0 1px 0 #fff;
  filter: alpha(opacity=20);
  opacity: 0.2;
}
.modal-header .close span {
  vertical-align: sub;
}
.modal-header {
  font-size: 20px;
}
.btn {
  border-radius: 0;
}
.modal-footer .btn {
  padding: 5px 15px;
}
.modal-content {
  border-radius: 0;
}
.modal-footer {
  border-top: 0;
  padding-top: 0;
}
@media (min-width: 370px) {
  .modal-dialog {
    width: 370px;
    margin: 30px auto;
  }
}
.modal-backdrop {
  background-color: #fff;
}
.span1{
  width: 408px;
  font-size: 35px;
  font-family: Alimama ShuHeiTi;
  font-weight: bold;
  color: #FFFFFF;
  line-height: 56px;
  text-align: center;
  margin-right: 30px;
  float: right;
  margin-top: 123px;
}
/*登录模态框*/
h2,
.h2 {
  font-size: 34px;
  width: 277px;
  font-weight: lighter;
  text-align: center;
  margin-left: 10%;
  margin-bottom: 70px;
}
h1,
h2,
h3 {
  margin-top: 20px;
  margin-bottom: 10px;
}
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 500;
  line-height: 1.1;
  color: inherit;
}
.form-control {
  display: block;
  width: 100%;
  height: 34px;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.428571429;
  color: #555;
  vertical-align: middle;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ccc;
  border-radius: 0;
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  -webkit-transition: border-color ease-in-out 0.15s,
    box-shadow ease-in-out 0.15s;
  transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
.btn-block {
  display: block;
  // width: 100%;
  cursor: pointer;
  // padding-right: 0;
  // padding-left: 0;
  color: #fff;
  border: none;
  // background: #408cff;
  border-radius: 10px;

  width: 277px;
  margin-left: 10%;
  height: 47px;
  background: #3F8CFF;
  box-shadow: 0px 6px 12px 0px rgba(63,140,255,0.26);
  border-radius: 14px;



  &:hover {
    background: #7fadf4;
  }
}
.btn-lg {
  padding: 10px 16px;
  font-size: 18px;
  line-height: 1.33;
}
.radio,
.checkbox {
  display: block;
  min-height: 20px;
  padding-left: 20px;
  margin-top: 10px;
  margin-bottom: 10px;
  vertical-align: middle;
}
.radio input[type="radio"],
.radio-inline input[type="radio"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
  float: left;
  margin-left: -20px;
}
input[type="radio"],
input[type="checkbox"] {
  margin: 4px 0 0;
  margin-top: 1px \9;
  line-height: normal;
}
input[type="checkbox"],
input[type="radio"] {
  padding: 0;
  box-sizing: border-box;
}
.form-signin {
width: 50%;
margin: 0 auto;
float: right;
position: absolute;
right: 0px;
margin-top: 170px;
}

.form-signin .form-signin-heading,
.form-signin .checkbox {
  margin-bottom: 30px;
}

.form-signin .checkbox {
  font-weight: normal;
  display: inline;
  margin: 0;
}

.form-signin .form-control {
  position: relative;
  font-size: 16px;
  height: auto;
  padding: 10px;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

.form-signin .form-control:focus {
  z-index: 2;
}

.form-signin input[type="text"],
.form-signin input[type="email"] {
  width: 277px;
  margin-left: 10%;
  /*margin-bottom: -1px;*/
  margin-bottom: 15px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.form-signin input[type="password"] {
  width: 277px;
  margin-left: 10%;
  margin-bottom: 20px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/*登录注册内容切换*/
.form-signin-actions {
  position: relative;
  margin: 10px 0 30px 0;
}
#login .switch {
  display: inline-block;
  float: right;
  cursor: pointer;
  position: absolute;
  top: 0;
  right: 0;
}
#login .switch:hover {
  color: #428bca;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}
</style>
